
var timerButton = document.getElementById('timer')
var messageButton = document.getElementById('message')


var counter = 1

/*

  () => void
  function () {}

  (x: number) => boolean
  function (x: number): boolean {}

*/

function changeCb(cb: () => void) { 
  setTimeout(function () {
    timerButton.innerHTML = String(counter)
    counter++
    cb()
  }, 1000)
}

changeCb(function () {
  changeCb(function () {
    changeCb(function () {
      changeCb(function () {
        changeCb(function () {
          changeCb(function () {
            messageButton.innerHTML = 'Callback finished'
          })
        })
      })
    })
  })
})

